package com.xzh.service;

import com.github.pagehelper.PageHelper;
import com.xzh.dao.UserDao;
import com.xzh.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService{

    @Autowired
    private UserDao userDao;

    @Override
    public int userReg(User user) {
        return userDao.userReg(user);
    }

    @Override
    public User userLogin(User user) {
        return userDao.userLogin(user);
    }

    @Override
    public List<User> getAllUser() {
        return userDao.getAllUser();
    }

    @Override
    public int getTotal() {
        return userDao.getTotal();
    }

    @Override
    public List<User> getPageUsers(int pageSize, int pageIndex) {
        PageHelper.startPage(pageIndex,pageSize);
        return userDao.getAllUser();
    }
}
